package com.families.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("test")
@RequiresRoles(value= {"admin"})
public class TestController {

	@RequestMapping("judge")
	public String judge() {
		 Subject subject = SecurityUtils.getSubject();
		 if (subject.hasRole("admin")) {
			System.out.println("你是管理员");
		}else {
			System.out.println("你是用户");
			
		}
		return null;
		
	}
}
